﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using Salon.Properties;

namespace Salon
{
    public class CountryComboBox : FilterComboBox
    {
        public CountryComboBox()
        {
            
            XmlDocument document = new XmlDocument();
            document.LoadXml(Resources.countries);

            XmlNodeList countries = document.GetElementsByTagName("country");
            //XmlNodeList countries = document.SelectNodes("country");

            foreach (XmlNode country in countries)
            {
                XmlNode node = country["name"];

                if (node != null)
                    this.Items.Add(node.InnerText);
                
            }
            this.DropDownStyle = ComboBoxStyle.DropDownList;
        }

        public override String ColumnValue { get { return this.SelectedItem != null ? this.SelectedItem.ToString() : ""; } }

        public override void CleanUp()
        {
            this.SelectedItem = null;  
            
        }
    }
}
